package com.lenovo.manufacture.fragment;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.lenovo.manufacture.R;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class Dingdanguanli extends Fragment {
    private Context context;
    private View inflate;
    private ListView lv_ding_dan1;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = getActivity();
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        inflate = View.inflate(context, R.layout.ding_dan_guan_li, null);
        initView();
        lv_ding_dan1.setAdapter(new AdapterView());
        return inflate;
    }

    private void initView() {
        lv_ding_dan1 = inflate.findViewById(R.id.lv_ding_dan);
    }

    class AdapterView extends BaseAdapter {

        @Override
        public int getCount() {
            return 10;
        }

        @Override
        public Object getItem(int position) {
            return position;
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder = null;
            if (convertView == null) {
                convertView = View.inflate(context, R.layout.lv_ding_dan, null);
                holder = new ViewHolder(convertView);
                convertView.setTag(holder);
            } else {
                holder  = (ViewHolder) convertView.getTag();
            }
            return convertView;
        }

        class ViewHolder {
            public View rootView;
            public TextView tv_ding_chexing;
            public TextView tv_ding_shijian;
            public TextView tv_ding_num;
            public TextView tv_ding_pailiang;
            public TextView tv_ding_bianshu;
            public TextView tv_ding_luntai;
            public TextView tv_ding_zhongko;
            public TextView tv_ding_chace;
            public TextView tv_ding_xuangua;

            public ViewHolder(View rootView) {
                this.rootView = rootView;
                this.tv_ding_chexing = (TextView) rootView.findViewById(R.id.tv_ding_chexing);
                this.tv_ding_shijian = (TextView) rootView.findViewById(R.id.tv_ding_shijian);
                this.tv_ding_num = (TextView) rootView.findViewById(R.id.tv_ding_num);
                this.tv_ding_pailiang = (TextView) rootView.findViewById(R.id.tv_ding_pailiang);
                this.tv_ding_bianshu = (TextView) rootView.findViewById(R.id.tv_ding_bianshu);
                this.tv_ding_luntai = (TextView) rootView.findViewById(R.id.tv_ding_luntai);
                this.tv_ding_zhongko = (TextView) rootView.findViewById(R.id.tv_ding_zhongko);
                this.tv_ding_chace = (TextView) rootView.findViewById(R.id.tv_ding_chace);
                this.tv_ding_xuangua = (TextView) rootView.findViewById(R.id.tv_ding_xuangua);
            }

        }
    }
}
